home *** CD-ROM | disk | FTP | other *** search
- #! /bin/sh
- # postinst script for cups-driver-gutenprint
- #
- # see: dh_installdeb(1)
-
- set -e
-
- # summary of how this script can be called:
- # * <postinst> `configure' <most-recently-configured-version>
- # * <old-postinst> `abort-upgrade' <new version>
- # * <conflictor's-postinst> `abort-remove' `in-favour' <package>
- # <new-version>
- # * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
- # <failed-install-package> <version> `removing'
- # <conflicting-package> <version>
- # for details, see /usr/doc/packaging-manual/
- #
- # quoting from the policy:
- # Any necessary prompting should almost always be confined to the
- # post-installation script, and should be protected with a conditional
- # so that unnecessary prompting doesn't happen if a package's
- # installation fails and the `postinst' is called with `abort-upgrade',
- # `abort-remove' or `abort-deconfigure'.
-
- #s/^if\s+\[\s+"\$1"\s+=\s+"configure"\s+\];\s+then\s+ldconfig\b//m;
-
- if [ "$1" = "configure" ]; then
-
- # Upgrade in-use PPD files, continue on any failure
- cups-genppdupdate || true
- # Restart CUPS (to register new and updated PPDs)
- [ -x /etc/init.d/cups ] && invoke-rc.d cups force-reload || true
-
- # Upgrade from obsolete epson and canon backends
-
- # Note that the current CUPS usb backend, unlike the epson and canon
- # backends, does not allow direct use of device names, so these devices will
- # require manual modification of the device URI; we can't get the correct
- # IEEE-1284 device ID for a given device node without digging into the CUPS
- # internals.
- LC_ALL=C lpstat -h /var/run/cups/cups.sock -v |
- while read devinfo; do
- printer=$(echo $devinfo | sed -e 's;device for \(..*\): \(..*\):/\(.*\);\1;')
- backend=$(echo $devinfo | sed -e 's;device for \(..*\): \(..*\):/\(.*\);\2;')
- device=$(echo $devinfo | sed -e 's;device for \(..*\): \(..*\):/\(.*\);/\3;')
-
- if [ "$backend" = "epson" ] || [ "$backend" = "canon" ]; then
- echo "Backend $backend used by printer $printer is obsolete."
- newbackend='parallel'
- if ! echo "$device" | grep -q '^/dev'; then
- newbackend='socket'
- elif echo "$device" | grep -q 'usb'; then
- newbackend='usb'
- fi
- echo "Updating $printer to use $newbackend backend: $newbackend:$device"
- lpadmin -h /var/run/cups/cups.sock -p "$printer" -v "$newbackend:$device"
- lpstat -h /var/run/cups/cups.sock -v "$printer"
- else
- echo "Backend $backend used by printer $printer is current."
- fi
- done
-
- elif [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-remove" ] || [ "$1" = "abort-deconfigure" ]; then
- :
- else
- echo "postinst called with unknown argument \`$1'" >&2
- exit 0
- fi
-
- # dh_installdeb will replace this with shell code automatically
- # generated by other debhelper scripts.
-
-
-
- exit 0
-
-